package com.ballmaze.conn;

import lombok.Data;

@Data
public class Result {
    Integer status;
    String message;
    Object data;

    public static Result success(String message, Object data) {
        return new Result(Status.STATUS_SUCCESS, message, data);
    }

    public static Result fail(String message, Object data) {
        return new Result(Status.STATUS_FAIL, message, data);
    }

    public static Result error(String message, Object data) {
        return new Result(Status.STATUS_ERROR, message, data);
    }

    public static Result success(Object data) {
        return success(null, data);
    }

    public static Result fail(Object data) {
        return fail(null, data);
    }

    public static Result error(Object data) {
        return error(null, data);
    }

    private Result(Integer status, String message, Object data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public class Status {
        public static final int STATUS_SUCCESS = 200;
        public static final int STATUS_FAIL = 400;
        public static final int STATUS_ERROR = 500;
    }
}
